import { createIconSet } from "react-native-vector-icons";
import iconfont from "@/public/font/iconfont.json";

// 图标对象
const icons: { [k in string]: number } = {};

iconfont.glyphs.forEach(item => {
  // 使用时对应 name 属性即可使用
  const name = iconfont.css_prefix_text + item.font_class;
  icons[name] = item.unicode_decimal;

  // 兼容 Web calss 写法
  icons[item.font_class] = item.unicode_decimal;
});

console.log("icons: ", icons);

const CustomIcon = createIconSet(icons, "iconfont", "iconfont.ttf");

export default CustomIcon;
